package jym.tan.tmdb.method.get;

import java.net.URL;

import jym.tan.tmdb.TMDB;
import jym.tan.tmdb.bean.wrapper.MovieCastWrapper;
import jym.tan.tmdb.constant.TMDBConstants;
import jym.tan.tmdb.method.Base;

/**
 * The Class MovieCasts. This class is similar to the <b>Movie Casts</b> method described in 
 * <a href="http://help.themoviedb.org/kb/api/movie-casts">Movie Casts</a>.
 * This method is used to retrieve all of the movie cast information. The results are split into separate 
 * cast and crew arrays.
 * 
 * @author Tanmoy
 */
public class MovieCasts extends Base {

	/**
	 * Instantiates a new movie casts.
	 *
	 * @param tmdb 
	 * 		An instance of the {@link TMDB} class
	 */
	public MovieCasts(TMDB tmdb) {
		super(tmdb, TMDBConstants.MOVIE, TMDBConstants.CASTS);		
	}

	/**
	 * Gets a {@link MovieCastWrapper} object.
	 *
	 * @param movieId 
	 * 		The TMDB id / the IMDB id
	 * @return 
	 * 		The <code>MovieCastWrapper</code> object
	 * @throws Exception 
	 * 		If any kind off exception occurred
	 */
	public MovieCastWrapper getMovieCastWrapper(String movieId) throws Exception {
		URL movieCastURL = getUrl(movieId);
		MovieCastWrapper movieCastWrapper = getJsonObject(movieCastURL, MovieCastWrapper.class);
		return movieCastWrapper;		
	}
}
